<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/7/19 17:21
 */

namespace App\Project\Auth\Provider;

use Illuminate\Auth\EloquentUserProvider;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;

class DoctorUserProvider extends EloquentUserProvider
{
    /**
     * Validate a user against the given credentials.
     * @param \Illuminate\Contracts\Auth\Authenticatable $user
     * @param array                                      $credentials
     * @return bool
     */
    public function validateCredentials(UserContract $user, array $credentials)
    {
        if ($password = $user->getAuthPassword()) {
            return md5($credentials['password']) == $password;
        }

        return false;
    }
}